import { Ref } from "vue";

export default (domRef: Ref<HTMLElement | undefined>) => {
    const isHidden = ref(false)
    const io = new IntersectionObserver((mutations) => {
        isHidden.value = !mutations[0].isIntersecting;
    });

    onMounted(() => {
        io.observe(domRef.value!);
    });
    return isHidden
}
